package com.ftg.learn.chapter10.base02.service;

import com.ftg.learn.chapter10.base02.entity.TeacherEntity;
import com.ftg.learn.chapter10.base02.mapper.TeachersBase02;
import com.ftg.learn.chapter10.base02.util.BaseUtil;
import com.ftg.learn.chapter10.base02.util.PageInfo;

import java.util.Map;

/**
 * 业务逻辑
 *
 * @author 布衣
 */
public class TeachersService {

    public PageInfo<TeacherEntity> splitPage(String tname, Integer pageNo, Integer pageSize){
        PageInfo<TeacherEntity> page = new PageInfo<>();
        //mapper
        TeachersBase02 bean = BaseUtil.getBean(TeachersBase02.class);

        page.setCode(0);
        page.setMsg("分页成功");
        page.setRows(bean.list(tname,pageNo,pageSize));
        page.setTotal(bean.count(tname));
        BaseUtil.GetInstance().close();
        return page;
    }

}
